# 种胡萝卜升级版
# 通过种植偏好伴生植物，提高产量
size = get_world_size()
companion = {}
for i in range(size):
	for j in range(size):
		companion[(i,j)] = 0
while True:
	for i in range(size):
		if can_harvest():
			harvest()
		if get_ground_type() != Grounds.Soil:
			till()
        if get_water() < 0.5:
			use_item(Items.Water)
		if companion[(get_pos_x(),get_pos_y())] != 0:
			plant(companion[(get_pos_x(),get_pos_y())])
			companion[(get_pos_x(),get_pos_y())] = 0
		if get_entity_type() == None:
			plant(Entities.Carrot)
			camp = get_companion()
			companion[camp[1]] = camp[0]
		move(North)
	move(East)